// import { fileURLToPath, URL } from "node:url";

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "node:path";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  // lintOnSave: false,
  resolve: {
    alias: {
      "@": path.join(__dirname, "src"),
      // "@": fileURLToPath(new URL("./src", import.meta.url)),
    },
  },
  server: {
    host: "localhost",
    port: 3000,
    open: true,
    proxy: {
      "/api": {
        target:
          "https://www.fastmock.site/mock/9db7f6dce3f3b34221117904a74e317a",
        changeOrigin: true,
        rewrite: (path) => path.replace("^/api", "/api"),
      },
    },
  },
});
